package com.link.wseller.mapper.impl;

import com.link.wseller.domain.OrderMaster;
import com.link.wseller.mapper.OrderMasterMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

@Mapper
public interface OrderMasterMapperImpl extends OrderMasterMapper{

    @Select({
            "select",
            "order_id, buyer_name, buyer_phone, buyer_address, buyer_openid, order_amount, ",
            "order_status, pay_status, create_time, update_time",
            "from order_master",
            "where buyer_openid = #{openId,jdbcType=VARCHAR}"
    })
    @Results({
            @Result(column="order_id", property="orderId", jdbcType= JdbcType.VARCHAR, id=true),
            @Result(column="buyer_name", property="buyerName", jdbcType=JdbcType.VARCHAR),
            @Result(column="buyer_phone", property="buyerPhone", jdbcType=JdbcType.VARCHAR),
            @Result(column="buyer_address", property="buyerAddress", jdbcType=JdbcType.VARCHAR),
            @Result(column="buyer_openid", property="buyerOpenid", jdbcType=JdbcType.VARCHAR),
            @Result(column="order_amount", property="orderAmount", jdbcType=JdbcType.DECIMAL),
            @Result(column="order_status", property="orderStatus", jdbcType=JdbcType.TINYINT),
            @Result(column="pay_status", property="payStatus", jdbcType=JdbcType.TINYINT),
            @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
            @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<OrderMaster> selectByOpenId(String openId);
}
